package personal.lijun.skeleton.springcloud.dataaccess.dao;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import personal.lijun.skeleton.springcloud.dataaccess.data.Events;
import personal.lijun.skeleton.springcloud.dataaccess.data.EventsExample;

public interface EventsMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    int countByExample(EventsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    int deleteByExample(EventsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    @Delete({
        "delete from events",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    @Insert({
        "insert into events (description, summary, ",
        "`when`, attendee, ",
        "owner)",
        "values (#{description,jdbcType=VARCHAR}, #{summary,jdbcType=VARCHAR}, ",
        "#{when,jdbcType=TIMESTAMP}, #{attendee,jdbcType=BIGINT}, ",
        "#{owner,jdbcType=BIGINT})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Events record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    int insertSelective(Events record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    List<Events> selectByExample(EventsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, description, summary, `when`, attendee, owner",
        "from events",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    Events selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") Events record, @Param("example") EventsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") Events record, @Param("example") EventsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(Events record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table eventss
     *
     * @mbggenerated
     */
    @Update({
        "update events",
        "set description = #{description,jdbcType=VARCHAR},",
          "summary = #{summary,jdbcType=VARCHAR},",
          "`when` = #{when,jdbcType=TIMESTAMP},",
          "attendee = #{attendee,jdbcType=BIGINT},",
          "owner = #{owner,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Events record);
}